package day3

class Dog(val na:String) {
  val id= 1
  private var name = "xiaoqing"

  def printName():Unit={
    println(Dog.CONSTRANT + name)
  }



  def this(na:String, sex:String){
    this(na)
    println(sex)
  }
}


object Dog{
  private val CONSTRANT = " 旺旺"
  def apply(na:String): Dog = new Dog(na)
  //def apply(na:String, param:String*): Dog = new Dog(na, param)
  def main(args: Array[String]): Unit = {
//    val dog = new Dog;
    val dog = Dog("dddd")
    //val dog = new Dog("na")
    println(dog.id)
    println(dog.name)
    dog.printName()

    //val array = Array(1, 32)
  }
}